'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	let hospital = await db.collection("hospitals")
		.where({
			location: db.command.geoNear({
				geometry: new db.Geo.Point(event.user_longitude,event.user_latitude),
				maxDistance: 200000000,
				minDistance: 0,
			})
		})
		.get()
	//返回数据给客户端
	console.log(hospital)

	return hospital
};
